package se.webbzon.boltzmann.object.factory;

import se.webbzon.boltzmann.resource.Resources;
import se.webbzon.oschi01.worldeditor.DeflatableWorldObject;
import se.webbzon.oschi01.worldeditor.WorldObjectDeflation;
import se.webbzon.oschi01.worldobject.WorldMovableObject;
import se.webbzon.oschi01.worldobject.appearance.Appearance3D;
import se.webbzon.oschi01.worldobject.appearance.CubeAppearance3D;
import se.webbzon.oschi01.worldobject.appearance.SimpleAppearance3D;

public class InstanceFactoryObject extends WorldMovableObject implements DeflatableWorldObject {

	// The name of this deflatable world object
	public static final String worldObjectName = "factoryObject";
	
	// The name of the instance factory associated with this instance factory object
	private String factoryName;
	
	/*============================================================
	Constructors
	============================================================*/
	
	public InstanceFactoryObject() {
		this("");
	}
	
	public InstanceFactoryObject(String factoryName) {
		super(0,createAppearance());
		this.factoryName = factoryName;
	}
	
	/*============================================================
	Public Methods
	============================================================*/
	
	/** Returns the name of the factory associated with this factory object. **/
	public String getFactoryName() {
		return factoryName;
	}
	
	/** Sets the name of the factory associated with this factory object. **/
	public void setFactoryName(String factoryName) {
		this.factoryName = factoryName;
	}

	@Override public String getName() {
		return worldObjectName;
	}

	@Override public WorldObjectDeflation getDeflation() {
		return new InstanceFactoryDeflation(0,this);
	}
	
	/*============================================================
	Private Methods
	============================================================*/
	
	private static final Appearance3D createAppearance() {
		SimpleAppearance3D appearance = new CubeAppearance3D();
		appearance.setTextureSet(Resources.getTextureSet("misc_unknown"));
		return appearance;
	}

	

}
